/**
 * IBatisSqlMapEditor.java : [com.ibader.eclipse.editors] Created on 2009. 5. 17.
 *
 * Copyright (c) 2009 Raccoon Project Team.
 * Seoul, Korea
 * All rights reserved.
 *
 */
package com.ibader.eclipse.editors;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.editor.FormEditor;

import com.ibader.eclipse.Activator;
import com.ibader.eclipse.editors.sqlmapconfig.SqlMapConfigOverviewPage;

/**
 * @author KimJungSu
 * @version
 */
public class SqlMapConfigEditor extends FormEditor {

	// define page constant
	public static final int PAGE_OVERVIEW = 0;
	public static final int PAGE_XML = 1;

	// define form page
	private SqlMapConfigOverviewPage overviewPage;
	private XMLEditor xmlPage;

	public SqlMapConfigEditor() {
		super();
		// TODO Auto-generated constructor stub
	}

	@Override
	public void dispose() {
		// TODO Auto-generated method stub
		Activator.log("+++SqlMapConfigEditor::dispose");
		super.dispose();
		Activator.log("---SqlMapConfigEditor::dispose");
	}

	@Override
	public void init(IEditorSite site, IEditorInput input)
			throws PartInitException {
		// TODO Auto-generated method stub
		Activator.log("+++SqlMapConfigEditor::init");
		super.init(site, input);
		Activator.log("---SqlMapConfigEditor::init");
	}

	@Override
	public boolean isDirty() {
		// TODO Auto-generated method stub
		return super.isDirty();
	}

	@Override
	public void removePage(int pageIndex) {
		// TODO Auto-generated method stub
		super.removePage(pageIndex);
	}

	@Override
	public void setFocus() {
		// TODO Auto-generated method stub
		Activator.log("+++SqlMapConfigEditor::setFocus");

		switch(getActivePage()) {
		case PAGE_OVERVIEW:
			break;

		case PAGE_XML:
			break;

		default:
			Activator.log("invalid active page.");
		}

		Activator.log("---SqlMapConfigEditor::setFocus");
	}

	@Override
	public void doSave(IProgressMonitor monitor) {
		// TODO Auto-generated method stub
		Activator.log("+++SqlMapConfigEditor::doSave");
		Activator.log("---SqlMapConfigEditor::doSave");
	}

	@Override
	public void doSaveAs() {
		// TODO Auto-generated method stub
		Activator.log("+++SqlMapConfigEditor::doSaveAs");
		Activator.log("---SqlMapConfigEditor::doSaveAs");
	}

	@Override
	public boolean isSaveAsAllowed() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	protected void addPages() {
		// TODO Auto-generated method stub
		Activator.log("+++SqlMapConfigEditor::addPages");

		try {
			overviewPage = new SqlMapConfigOverviewPage(this, "SqlMapConfigOverview", "Overview");
			addPage(overviewPage);

			xmlPage = new XMLEditor(this);
			setPageText(addPage(xmlPage, this.getEditorInput()), "xml");

		} catch (PartInitException e) {
			// TODO Auto-generated catch block

		}

		Activator.log("---SqlMapConfigEditor::addPages");
	}


}
